#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;

int main(){
	int n;
	vector<int> v;
	scanf("%d",&n);
	for(int i=2;i<=n;i++){
		for(int j=1;j<=sqrt(i);j++){
			if(i%j==0){
				v.push_back(j);
				v.push_back(i/j);
			}
		}
		sort(v.begin(),v.end());
		v.pop_back();
		int sum=0;
		for(int k=0;k<v.size();k++){
			sum+=v[k];
		}
		if(sum==i){
			printf("%d its factors are ",i);
			for(int k=0;k<v.size();k++){
				if(k!=v.size()-1){
					printf("%d ",v[k]);
				}else{
					printf("%d\n",v[k]);
				}
			}
		}
		v.clear();
	}
	return 0;
} 
